#pragma once

#include <cstdint>

#include <stdexcept>

#include "fs.h"


namespace imgutil
{

class UnsupportedFormat : public std::logic_error
{
public:
    UnsupportedFormat(const char *msg) : std::logic_error(msg) {}
    virtual ~UnsupportedFormat() {}
};

class Size
{
public:
    using Width = int32_t;
    using Height = int32_t;

    static Size null() {
        return Size(-1, -1);
    }

    Size(Width width, Height height)
        : width_(width), height_(height) {}

    operator bool() const {
        return width_ >= 0 && height_ >= 0;
    }

    Width width() const {
        return width_;
    }

    Height height() const {
        return height_;
    }

private:
    Width width_ = 0;
    Height height_ = 0;
};

Size imgSize(const fs::path &path);


} // namespace imgutil
